<?php

/**
 * Update resource image url, doesnot need to invoke douban API every time
 * using jsonp
 *
 * @author Jensen
 */
class index extends AbstractAction {

    public function run() {
        $itemId = intval($_GET['id']);
        $imgUrl = cleanInput($_GET['imgurl']);
        $callback = cleanInput($_GET['callback']);

        $itemDAO = new BTItemsDAO();
        if ($itemDAO->UpdateItemImgUrl($itemId, $imgUrl)) {
            jsonp_output($callback, 0, 'OK');
        } else {
            jsonp_output($callback, 1, 'update failed');
        }
    }

}

?>
